package com.example.exercise.common.swagger;

//import io.swagger.annotations.ApiOperation;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Profile;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Contact;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;

//@Configuration
//@EnableSwagger2
public class SwaggerConfig {

//    @Profile(value = "dev")
//    @Bean
//    public Docket createRestApi() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(this.apiInfo())
//                .select()
//                .apis(basePackage("com.example.exercise"))//启动类已经注解了可访问路径
//                .apis(input -> input != null && input.isAnnotatedWith(ApiOperation.class))
//                .paths(PathSelectors.regex("(?!/error.*).*"))
//                .build();
//    }

//    @Profile(value = "prod")
//    @Bean
//    public Docket createRestApiProd() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(this.apiInfo())
//                .select()
//                //也可以在启动类上加上@ComponentScan({"springfox", "com.example.app"})
////                .apis(basePackage("com.example.exercise"))//启动类已经注解了可访问路径
//                .apis(input -> input != null && input.isAnnotatedWith(ApiOperation.class))
//                .paths(PathSelectors.regex("/error/.*"))
//                .build();
//    }

//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("常用功能")
//                .description("暂无描述信息")
//                .termsOfServiceUrl("***")
//                .contact(new Contact("zhzhair","https://github.com/zhzhair","495359612@qq.com"))
//                .version("1.0-beta")
//                .build();
//    }

}
